package cn.edu.java.io.writer;

import java.io.FileWriter;
import java.io.IOException;

public class FileWriterDemo {
    public static void main(String[] args) {

        try (FileWriter writer = new FileWriter("output/file.txt")) {

            // 写入字符流
            writer.write("Hello, World!");

            System.out.println("文件写入成功！");
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

